package com.example.myapplication.AsyncTasks;

import android.os.AsyncTask;
import com.example.myapplication.Note;
import com.example.myapplication.RemoteData.RemoteDataJsonHelper;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import java.util.ArrayList;

public class PostJsonTask extends AsyncTask<ArrayList<Note>, Void, Void> {

  private RefreshLayout refreshLayout;
  public PostJsonTask(RefreshLayout refreshLayout) {
    this.refreshLayout = refreshLayout;
  }
  @Override protected Void doInBackground(ArrayList<Note>... params) {
    ArrayList<Note> notes = params[0];

    RemoteDataJsonHelper remoteDataPostHelper=new RemoteDataJsonHelper();
    remoteDataPostHelper.UpLoadDataToServer(notes);

    return null;
  }

  @Override protected void onPostExecute(Void unused) {
    refreshLayout.autoRefresh();
  }
}
